import { defineStore } from "pinia";
import { UserModel } from "@/api/model/user.model.ts";

const useUserStore = defineStore("user", {
    state() {
        return {
            _user: null
        } as {
            _user: UserModel | null
        }
    },
    getters: {
        containsUser: state => state._user && state._user.username,
        user: state => state._user
    },
    actions: {
        updateUser(user: UserModel) {
            this._user = user;
        }
    }
});

export {
    useUserStore
}